<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/include/header.jsp"%>
<script type="text/javascript" src="msi/question/question.js"></script>
<div class="easyui-layout" style="width:700px;height:400px;" fit="true">
	<div region="west" split="true" title="样题库分类" style="width:200px;">
		<div style="padding:5px;background:#fafafa;border-bottom:1px solid #eee;">
			<table cellpadding="0" cellspacing="0" style="width:100%">
				<tr>
					<td style="text-align:right">
						<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-add" onclick="appendNodePage();">新增节点</a>
					</td>
					<td style="text-align:right">
						<a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-remove" onclick="delNode()">删除节点</a>
					</td>
				</tr>
			</table>
		</div>
		<div>
			<ul id="sortTree"></ul>
		</div>
	</div>
	<div region="center" title="" id="centerTitle" style="background:#fafafa;">
		<table id="questionList" toolbar="#toolbar"></table>
	</div>
	<div id="toolbar" class="toolbar">
		<table cellpadding="0" cellspacing="0" style="width:100%">
			<tr>
				<td>
					<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="openQuestion();">创建样题</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="delQuestion();">删除样题</a>
				</td>
				<td style="text-align:right">
					<input id="q" class="easyui-searchbox" prompt="按标题名称查询" searcher="normalQuestionQuery" style="width:200px"></input>
				</td>
			</tr>
		</table>
	</div>
</div>
<div id="sortDialog" class="easyui-dialog" style="width:480px;height:260px;position:relative" closed="true" modal="true"></div>
<div id="questionDialog" class="easyui-dialog" style="width:480px;height:460px;position:relative" closed="true" modal="true"></div>

<%@ include file="/include/footer.jsp"%>
<script type="text/javascript">
	$('#sortTree').tree({
		url: 'searchSort.do',
		onClick:function(node){
			var title = node.text;
			var url = "searchQuestion.do?question.sortId="+node.id;
			$("#questionList").datagrid({
				width : 700,
				url:url,
				title:title,
				idField:"questionId",
				fit:true,
				singleSelect:true,
				pagination:true,
				rownumbers:true,
				columns:[[{title:'标题',field:'questionTitle',width:400,align:"left"}]],
				onDblClickRow:function(rowIndex, rowData) {
					openQuestion(rowData.questionId);
				}
			});
		}
	});
</script>